//
//  CCConfig.swift
//  CCFoundation_Swift
//
//  Created by zjh on 2021/10/15.
//

import UIKit

public let ScreenWidth = UIScreen.main.bounds.width
public let ScreenHeight = UIScreen.main.bounds.height

public let isIPhone6 =  UIScreen.main.currentMode?.size == CGSize.init(width: 750, height: 1334)
public let isIPhoneX =  UIScreen.main.currentMode?.size == CGSize.init(width: 1125, height: 2436)
public let isIPhoneXR =  UIScreen.main.currentMode?.size == CGSize.init(width: 828, height: 1792)
public let isIPhoneXs_Max =  UIScreen.main.currentMode?.size == CGSize.init(width: 1242, height: 2688)
public let isIPhone12 =  UIScreen.main.currentMode?.size == CGSize.init(width: 1170, height: 2532) ///12和13一致
public let isIPhone13 =  UIScreen.main.currentMode?.size == CGSize.init(width: 1170, height: 2532) ///
public let isIPhone12_Max =  UIScreen.main.currentMode?.size == CGSize.init(width: 1284, height: 2778) ///12 max 和13max一致
public let isIPhone13_Max =  UIScreen.main.currentMode?.size == CGSize.init(width: 1284, height: 2778) ///


public let isIPhoneX_All =  isIPhoneX || isIPhoneXR || isIPhoneXs_Max || isIPhone12 || isIPhone12_Max


public let statusBarHeight = UIApplication.shared.statusBarFrame.size.height//[[UIApplication sharedApplication] statusBarFrame].size.height
public let navBarHeight = 44.0
public let tabBarHeight = UIApplication.shared.statusBarFrame.size.height > 20 ? 83 : 49
public let topHeight = statusBarHeight + navBarHeight
public let buttomHeight = UIApplication.shared.statusBarFrame.size.height > 20 ? 34 : 0


func getTable(style: UITableView.Style) -> UITableView {
    let tableView = UITableView(frame: .zero, style: style)
    tableView.separatorStyle = .none
    tableView.estimatedRowHeight = 0
    tableView.estimatedSectionFooterHeight = 0
    tableView.estimatedSectionHeaderHeight = 0
    return tableView
}

func CCScale(n: CGFloat) -> CGFloat {
    return n / 375.0 * ScreenWidth
}
